home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gtlayout / source / ltp_printlabel.c < prev    next >
C/C++ Source or Header  |  1999-04-19  |  1KB  |  61 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1998 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #include "Assert.h"
  15.  
  16. VOID
  17. LTP_PrintLabel(LayoutHandle *handle,ObjectNode *node,LONG left,LONG top)
  18. {
  19.     struct RastPort *rp;
  20.     STRPTR label;
  21.     LONG underscore;
  22.     LONG len;
  23.  
  24.     rp = &handle->RPort;
  25.  
  26.     LTP_SetPens(rp,node->HighLabel ? handle->DrawInfo->dri_Pens[HIGHLIGHTTEXTPEN] : handle->TextPen,0,JAM1);
  27.  
  28.     Move(rp,left - (node->LabelWidth + INTERWIDTH),top + rp->TxBaseline);
  29.  
  30.     label = node->Label;
  31.  
  32.     len = strlen(label);
  33.     underscore = 0;
  34.  
  35.     while(label[underscore] != '_' && underscore < len)
  36.         underscore++;
  37.  
  38.     if(underscore)
  39.         Text(rp,label,underscore);
  40.  
  41.     if(underscore < len - 1)
  42.     {
  43.         ULONG OldStyle;
  44.  
  45.         underscore += 2;
  46.         label += underscore;
  47.         len -= underscore;
  48.  
  49.         OldStyle = rp->AlgoStyle;
  50.  
  51.         SetSoftStyle(rp,FSF_UNDERLINED,FSF_UNDERLINED);
  52.  
  53.         Text(rp,label - 1,1);
  54.  
  55.         SetSoftStyle(rp,OldStyle,FSF_UNDERLINED);
  56.  
  57.         if(len)
  58.             Text(rp,label,len);
  59.     }
  60. }
  61.